<?php 

	function get_header($page,$mode=''){
		$navstr = NULL;
		$numinfo = NULL;
		$admintext = NULL;
		
		
		if($page != 'admin'){
			$logstr = "<p><a href=\"saleslogin.php\">Login Sales</a></p>";
			if(@$_SESSION['salesName']){
				$logstr = "<div class=0\"head-right-portion right\"><p>Hello there, ".@$_SESSION['salesName']."!&nbsp;&nbsp;|&nbsp;&nbsp; <a href=\"sales-logout.php\">logout.</a></p></div>";
			}else if(@$_SESSION['req_name']){
				$logstr = "<div class=0\"head-right-portion right\"><p>Hello there, ".@$_SESSION['req_name']."!&nbsp;&nbsp;|&nbsp;&nbsp; <a href=\"sales-logout.php\">logout.</a></p></div>";
			}
			$numinfo = "
			
			<div class=\"head-right-portion right\">
            <div class=\"head-telno gray\" align=\"right\">
				$logstr
				<p>Phone <strong>009714 353 5455</strong><br>Mobile <strong>009714 353 4283</strong></p></div>
			</div>
			";
			
			$navstr = ' <nav>
				<ul>
					<li><a ';
			$currentpage = ($page == 'faq')?'class="active"':'';
			$navstr .= $currentpage.' href="faq.php">FAQ</a></li><li><a ';	
			$currentpage = ($page == 'about')?'class="active"':'';	
			$navstr .= $currentpage.' href="about.php">About</a></li><li><a ';
			$currentpage = ($page == 'contactpage')?'class="active"':'';
			$navstr .= $currentpage.' href="contactpage.php">Contact</a></li><li><a ';
			$currentpage = ($page == 'leduses')?'class="active"':'';
			$navstr .= $currentpage.' href="leduses.php">Use of LED in Real</a></li><li><a ';
			$currentpage = ($page == 'ledbasics')?'class="active"':'';
			$navstr .= $currentpage.'	href="ledbasics.php">Basics of LED</a></li><li><a ';
			$currentpage = ($page == 'products')?'class="active"':'';
			$navstr .= $currentpage.'	href="products.php">Products</a></li><li><a ';
			$currentpage = ($page == 'rquote')?'class="active"':'';
			$navstr .= $currentpage.' href="rquote.php">Request Quote</a></li>
				</ul>
			</nav>';
		}else{
			if(!@$_SESSION['user_admin']){
				//do nothing
			}else{
				$admintext = "<div class=\"j-adpanel\"><h3 align=\"right\">Administrator Panel</h3></div>";
			}
		}
		
		$html = '<div class="header-bg">
					<header>    	
						<div class="logo col_7 col">
							<a href="index.php"><h1 id="logo" class="left">LEDLAMPS</h1></a>            
						</div>'.$admintext.$numinfo.'
						<div class="clear"></div>
						'.$navstr.'
					</header>
				</div>'; 
	echo $html;

	}


function curPageURL() {
		$pageURL = 'http';
		if (@$_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
			$pageURL .= "://";
		if (@$_SERVER["SERVER_PORT"] != "80") {
				$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
		} else {
			$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		}
		return $pageURL;
	}
function curPageURL_folder(){
	$url = explode("/",curPageURL());
	$cnt = count($url);
	$cnt--;
	$newstr = "";
	for($cc = 0; $cc<$cnt; $cc++){
		$newstr .=  $url[$cc].'/';
	}
	return $newstr;
}


?>